Skip to content

Conversation

@jrflat
Copy link
Contributor

@jrflat jrflat commented Aug 19, 2024

Before this change, URL.host would just call .host(), which defaults to .host(percentEncoded: true). This meant that if the host was IDNA-encoded, .host would decode the IDNA-encoding and then percent-encode, returning the percent-encoded string.

This PR fixes .host to match the behavior before the Swift URL implementation:

  • If the host was percent-encoded, return the percent-decoded host
  • If the host was IDNA-encoded (or not encoded at all), return that host string

This is exactly the behavior of .host(percentEncoded: false), which is now used instead of .host().

Resolves #863 (thanks @Lukasa!)

@jrflat
Copy link
Contributor Author

jrflat commented Aug 19, 2024

@swift-ci please test

@Lukasa
Copy link
Contributor

Lukasa commented Aug 20, 2024

No, thank you @jrflat! 🎉

@jrflat jrflat force-pushed the url-host-no-encoding branch from fb88623 to da61158 Compare August 20, 2024 15:06
@jrflat
Copy link
Contributor Author

jrflat commented Aug 20, 2024

Fixed conflicts
@swift-ci please test

@jrflat
Copy link
Contributor Author

jrflat commented Aug 20, 2024

@swift-ci please test

@jrflat jrflat requested review from jmschonfeld and parkera August 21, 2024 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

URL Parsing behaviour changed on Linux between 5.10 and 6.0

4 participants